package com.suns.server;

import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
import io.grpc.util.MutableHandlerRegistry;
import java.io.IOException;

/**
 * @author xiangminwen
 * @date 2024/4/3 11:00
 */
public class GrpcServer {

    public static void main(String[] args) throws IOException, InterruptedException {
        final MutableHandlerRegistry handler = new MutableHandlerRegistry();
        handler.addService(new HelloServiceImpl());
        NettyServerBuilder.forPort(9000).fallbackHandlerRegistry(handler).build().start().awaitTermination();

//        //绑定端口
//        ServerBuilder<?> build = ServerBuilder.forPort(9000);
//        //发布服务
//        build.addService(new HelloServiceImpl());
//        //启动服务
//        Server server = build.build();
//        server.start();
//        server.awaitTermination();
    }
}
